
<template>
<div>

        <el-form :inline="true" :model="params" class="demo-form-inline">
           
            <el-form-item label="日期">
                <el-input v-model="params.start_date" type="date"  value-format="yyyy-MM-dd"  clearable></el-input>
            </el-form-item>
            <el-form-item label="-">
                <el-input v-model="params.end_date" type="date"  value-format="yyyy-MM-dd"  clearable></el-input>
            </el-form-item>
             <el-form-item label="姓名">
                <el-input v-model="params.name"></el-input>
            </el-form-item>
            <el-form-item label="身份证号">
                <el-input v-model="params.sfz"></el-input>
            </el-form-item>
             <el-form-item label="工种">
                <el-select v-model="laber.profession" clearable>
                     <el-option v-for="t in professions" v-bind:key="t.id" :label="t.profession_name" :value="t.id"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="项目名称">
                <el-input v-model="params.p_id" @focus="pid" clearable></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="list">查询</el-button>
            </el-form-item>
        </el-form>

        <div >
        <font size="6" bold   style="position:relative;left:650px">劳务实名制列表</font>
      </div>
      <br>

      <div id="b" style="width: 100%;height: 80%;overflow-y: scroll">
            <el-table
                    :data="showData"
                    @row-click="getRow"
                    border>
                <el-table-column
                        prop="name"
                        label="姓名">
                </el-table-column>
                <el-table-column
                        prop="sfz"
                        label="身份证号">
                </el-table-column>
                <el-table-column
                        prop="profession_name"
                        label="工种">
                </el-table-column>
                <el-table-column
                        prop="apply_date"
                        label="日期">
                </el-table-column>
                <el-table-column
                        prop="project_name"
                        label="项目名称">
                </el-table-column>
                <el-table-column
                        prop="commit"
                        label="工作内容">
                </el-table-column>
            </el-table>
            <el-divider></el-divider>
            <el-footer class="case-list-footer">
                <el-pagination
                        style="margin: 10px auto"
                        background
                        layout="total , sizes ,prev, pager, next,jumper"
                        :page-sizes="[5,10,15,20]"
                        :total="pageResult.total"
                        :page-size="pageResult.size"
                        class="pagination"
                        @current-change="handleIndexChange"
                        @size-change="handleSizeChange"
                >
                </el-pagination>
            </el-footer>
        </div>



    <!--所属项目子组件-->
<el-dialog  :visible.sync="dialogVisible"  width="50%">
<project-info-list  v-if="dialogVisible"  @row="project"></project-info-list>
</el-dialog>

  </div>
</template>

<script>

import ProjectInfoList from '../common/projectInfo/ProjectInfoList.vue';


import LaoWuShiMingZhi from '@/model/smj/LaoWuShiMingZhi'
const laowushimingzhi = new LaoWuShiMingZhi;


export default {
  name: "LaoWuHeTongTable",
  components: {ProjectInfoList},
  directives: {},
  data() {
    return {
        laber:{},
        professions:[],
        projectId:'',//所属项目id
        dialogVisible:false,//隐藏子组件

        pageResult:{},
        showData:[],
        params:{
            approveStatus:'3'
        },
    }
  },
  mounted() {},
  methods: {
      //开启隐藏项目子组件
      pid(){
           this.dialogVisible = true;
      },

      //响应项目组件
      project(row){
            this.params.p_id = row.projectName;
            this.projectId = row.id;//获取所属项目id
            this.dialogVisible = false;
      },

       getprofessions(){
            laowushimingzhi.getprofessions().then((response)=>{
                this.professions = response.data;
            })
      },


      //查询
      list(){
                //projectId:'',//所属项目id
                //providerId:'',//班组id
                //empId:'',
                if( this.params.p_id != '' || this.params.p_id != undefined){
                        this.params.projectId =this.projectId;
                }
                           
                laowushimingzhi.listrealname(this.params).then((response)=>{
                    this.pageResult =response.data.data.data
                    this.showData=response.data.data.data.records
                    //清空临时值
                    this.projectId='';
                    this.params={};

                })
            },
            getTypeId(id){
                this.params.providertype = id
                this.list()
            },
            handleIndexChange(index){
                this.params.page = index
                this.list()
            },
            handleSizeChange(size){
                this.params.size = size
                this.list()
            },
            search(){
                this.params.page=1
                this.list()
            },
            getRow(row){
                this.$router.push({path:"/LaoWuShiMingZhiRow",query:{id:row.id}});
            }
  },

  created() {
       this.list();
       this.getprofessions();
  },
  
};
</script>

<style>
</style>